<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <!--导入layui--><!--导入jquery包-->
    <script src="../jQuery/jquery-1.11.2.js"></script>
    <script src="../layer/layer/layer.js"></script>
    <!--导入layui包-->
    <link rel="stylesheet" href="../layui/layui/css/layui.css"/>
    <script src="../layui/layui/layui.js"></script>
    <!--引入css文件-->
    <%--<link rel="stylesheet" href="../css/TeacherHome.css" />--%>
    <!--设置菜单栏动态选择效果-->
    <script type="text/javascript">
        $(function(){
            layui.use(['element','form'], function(){
                var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块
                var form=layui.form;
                //监听导航点击
                element.on('nav(demo)', function(elem){
                    layer.msg(elem.text());
                });
                //用于关闭窗口
                var closeDiv;
                $("#setSelf").click(function(){
                    //打开对话框
                    closeDiv=layer.open({
                        type:1,
                        title:"修改个人信息",
                        offset: 'auto',
                        area:["500px","400px"],
                        content:$("#MaxDiv").html()
                    });
                });

                //修改密码时点击确认
                form.on("submit(ok)",function(data){
                    var data1 = data.field;
                    if(data1.newTeacherPwd==data1.newTeacherPwds){
                        $.ajax({
                            url:"../PwdUpdate?method=teacherPwdPdt",
                            type: "POST",
                            data:"newTeacherPwd="+data1.newTeacherPwd+"&teacherPwd="+data1.teacherPwd,
                            dataType:"text",
                            success:function(data){
                                if (data=="ok"){
                                    layer.msg("修改密码成功")
                                    layer.close(closeDiv);
                                }else{
                                    layer.msg("修改密码失败")
                                }
                            }
                        });
                    }else{
                        layer.msg("您输入的密码和重复密码不相符")
                    }
                    return false;
                });

                //动态显示导航栏
                $.ajax({
                    url:"../RoleServlet?method=editRole&roleId="+${sessionScope.roleId},
                    type:"POST",
                    data:"",
                    success:function(data){
                        var data=$.parseJSON(data);
                        show(data);
                    }
                });

                function show(data){
                    $.each(data,function (i,item) {
                        if (item.checked==true){
                            content='<li class="layui-nav-item">';
                            content+='<a href="javascript:;" class="layui-icon layui-icon-user"  name="'+item.url+'"  style="font-size: 22px">'+item.title+'</a>';
                            if(item.children!=undefined && item.children!=""&& item.children.length>0) {
                                content += '<dl class="layui-nav-child">';
                                $.each(item.children, function (j, item2) {
                                    content+='<dd><a href="javascript:;" class="layui-icon layui-icon-file"  name="'+item.url+'"  style="font-size: 20px">'+item2.title+'</a></dd>'
                                });
                                content+='</dl>';
                            }
                            content+='</li>'
                            $("#demo").append(content);
                            element.init();
                        }
                    });
                };

                /*function sssss(data){
                    $.each(data.data,function (i,item) {
                        content='<li class="layui-nav-item">';
                        content+='<a class="site-demo-active layui-icon layui-icon-star-fill" href="javascript:;" name="'+item.url+'" data-title="'+item.title+'"  data-id="'+item.id+'" data-type="tabAdd">'+item.title+'</a>';
                        if(item.children!=undefined && item.children!=""&& item.children.length>0) {
                            content += '<dl class="layui-nav-child">';
                            $.each(item.children, function (j, item2) {
                                content+='<dd><a class="site-demo-active layui-icon layui-icon-user" href="javascript:;" data-url="'+item2.url+'" data-title="'+item2.title+'"  data-id="'+item2.id+'" data-type="tabAdd">'+item2.title+'</a></dd>'
                            });
                            content+='</dl>';
                        }
                        content+='</li>'
                        $("#menu").append(content);
                        element.init();
                    });

                };
*/


            });

            //点击动态添加的导航栏
            $("#demo").on("click",".layui-icon",function(){
                var s=$(this).text();
                var iframe = $("#iframe");
                if (s=="首页"){
                    $("#iframe").attr("src","BackMains.jsp");
                }else if(s=="班级管理"){//判断点击的是首页
                    $("#iframe").attr("src","BackClassManage.jsp");
                }else if (s=="学员管理"){
                    $("#iframe").attr("src","BackStudent.jsp");
                }else if (s=="课程管理"){
                    $("#iframe").attr("src","BackCourse.jsp");
                }else if (s=="成绩管理"){
                    $("#iframe").attr("src","BackGrade.jsp");
                }else if (s=="高级组卷") {
                    $("#iframe").attr("src", "MakePaper2.jsp");
                }else if (s=="自动组卷"){
                    $("#iframe").attr("src","MakePaper1.jsp");
                }else if (s=="试卷信息"){
                    $("#iframe").attr("src","BackPaper.jsp");
                }else if (s=="题库管理"){
                    $("#iframe").attr("src","BackSubjects.jsp");
                }else if (s=="公告管理"){
                    $("#iframe").attr("src","Announcement.jsp");
                }else if (s=="补考学员信息"){
                    $("#iframe").attr("src","BackReexamsManage.jsp");
                }else if (s=="试题难易管理"){
                    $("#iframe").attr("src","BackEasyList.jsp");
                }else if (s=="考生状态管理"){
                    $("#iframe").attr("src","BackStatu.jsp");
                }else if (s=="教师管理"){
                    $("#iframe").attr("src","Teacher.jsp");
                }else if (s=="权限管理"){
                    $("#iframe").attr("src","role2.jsp");
                }else if (s=="用户管理"){
                    $("#iframe").attr("src","user.jsp");
                }
            });

            //根据点击事件修改导入路径
            /*$(".layui-icon").click(function() {
                alert("ss");

            });*/



            //点击退出登录
            $("#a1").click(function(){
                window.location.href="login2.jsp";
            });




        });
    </script>
</head>
<body>

<!--修改GRE信息弹出对话框-->
<div style="display: none;" id="MaxDiv">
    <div style="margin-top: 40px;margin-left: 100px;">

        <form class="layui-form"  method="post" lay-filter="myForm">
            <!--用户编号-->
            <div  class="layui-form-item" lay-filter="user">
                <div class="layui-input-inline" <%--style="width: 350px;"--%> >
                    <input  type="password" name="teacherPwd" lay-verify="required" placeholder="--请输入原始密码--" style="width: 330px;"  autocomplete="off" class="layui-input " />
                </div>
            </div>

            <div  class="layui-form-item" lay-filter="user">
                <div class="layui-input-inline" >
                    <input type="password" name="newTeacherPwd" lay-verify="required" placeholder="--请输入新密码--"  style="width: 330px;"  autocomplete="off" class="layui-input" value="" >
                </div>
            </div>

            <div class="layui-form-i layui-input-inline">
                <div>
                    <input  type="password" name="newTeacherPwds" placeholder="--重新输入密码--" style="width: 330px;"  autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" style="margin-top: 20px" lay-submit lay-filter="ok" id="okk"  >修改</button>
                    <button type="reset" style="margin-top: 20px" class="layui-btn layui-btn-warm">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>



    <!--头部菜单栏-->
    <ul class="layui-nav">
        <li class="layui-nav-item">
            <img src="../img/logo4.gif" style="height: 70px;width: 70px;">
            <span style="font-size: 30px;color: darkgray;">后台管理系统</span>
        </li>
        <li class="layui-nav-item" lay-unselect="" style="left: 75%">
            <a href="javascript:;"><img src="../img/007.jpeg" class="layui-nav-img" style="height: 50px;width: 50px">我</a>
            <dl class="layui-nav-child">
                <dd><a href="javascript:;" id="setSelf" style="font-size: 20px">修改密码</a></dd>
                <dd><a href="javascript:;" id="a1" style="font-size: 20px">退出登录</a></dd>
            </dl>
        </li>

    </ul>

    <div>
        <ul class="layui-nav layui-nav-tree layui-inline" id="demo" lay-filter="demo" style="margin-top: 1px;height: 800px;float: left;">
            <%--<c:set var="boo" value="true"></c:set>
            <c:forEach items="${sessionScope.funIdlist}" var="funId" step="1">
                <c:if test="${funId.equals('L01')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-form" style="font-size: 22px">首页</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L02')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-user" style="font-size: 22px">班级管理</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L03')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-username" style="font-size: 22px">学员管理</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L04')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-file-b" style="font-size: 22px">成绩管理</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L05')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-friends" style="font-size: 22px">教师管理</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L06')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-notice" style="font-size: 22px">公告管理</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L07')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-survey" style="font-size: 22px">课程管理</a>
                    </li>
                </c:if>

                <c:if test="${funId.equals('L0801')}">
                    <li class="layui-nav-item">
                        <dd><a href="javascript:;" class="layui-icon layui-icon-file" style="font-size: 20px">高级组卷</a></dd>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L0802')}">
                    <li class="layui-nav-item">
                        <dd><a href="javascript:;" class="layui-icon layui-icon-file" style="font-size: 20px">自动组卷</a></dd>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L0803')}">
                    <li class="layui-nav-item">
                        <dd><a href="javascript:;" class="layui-icon layui-icon-file" style="font-size: 20px">试卷信息</a></dd>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L09')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-template" style="font-size: 22px">题库管理</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L010')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-username" style="font-size: 22px">补考学员信息</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L011')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-set-sm" style="font-size: 22px">试题难易管理</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L012')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-list" style="font-size: 22px">考生状态管理</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L013')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-list" style="font-size: 22px">权限管理</a>
                    </li>
                </c:if>
                <c:if test="${funId.equals('L014')}">
                    <li class="layui-nav-item">
                        <a href="javascript:;" class="layui-icon layui-icon-list" style="font-size: 22px">用户管理</a>
                    </li>
                </c:if>
            </c:forEach>--%>
        </ul>
    </div>

    <%--显示主要内容部分--%>
    <div style="width: 87%;height: 800px;margin-left: 200px;overflow: auto;">
        <iframe id="iframe" src="BackMains.jsp" style="width: 99%;height: 98%;"></iframe>
    </div>

    <%--页脚栏--%>

</body>
</html>